package com.android.vmg;

import android.os.Parcel;
import android.os.Parcelable;

class Circle implements Parcelable {
	
	private int mVal;
	private int mX;
	private int mY;
	private int mRadius;
	
	public Circle(int val, int x, int y, int radius) {
		
		mVal = val;
		mX = x;
		mY = y;
		mRadius = radius;
		
	}
	
	public Circle(Parcel in) {
		mVal = in.readInt();
		mX = in.readInt();
		mY = in.readInt();
		mRadius = in.readInt();
	}
	
	public int getVal() {
		return mVal;
	}
	public int getX() {
		return mX;
	}
	public int getY() {
		return mY;
	}
	public int getRadius() {
		return mRadius;
	}
	public boolean collide(int x, int y) {
		return Math.hypot(x - mX, y - mY) <= mRadius;
	}

//	@Override
	public int describeContents() {
		return 0;
	}

//	@Override
	public void writeToParcel(Parcel out, int flags) {
		out.writeInt(mVal);
		out.writeInt(mX);
		out.writeInt(mY);
		out.writeInt(mRadius);
	}
	
}